import Vue from 'vue';
import VueRouter, { RouteConfig } from 'vue-router';

Vue.use(VueRouter);

const routes: Array<RouteConfig> = [
    {
        path: '/',
        name: 'home',
        component: () => import(/* webpackChunkName: "home" */ '@/views/home.vue'),
        children: []
    },
    {
        path: '/loan',
        name: 'loan',
        component: () => import(/* webpackChunkName: "loan" */ '@/views/loan/loan-list.vue')
    },
    {
        path: '/json-editor',
        name: 'json-editor',
        component: () => import(/* webpackChunkName: "json-editor" */ '@/components/editor/json-editor-demo.vue')
    },
    {
        path: '/json-preview',
        name: 'json-preview',
        component: () => import(/* webpackChunkName: "json-preview" */ '@/components/json-preview.vue')
    },
];

const router = new VueRouter({
    mode: process.env.NODE_ENV === 'production' ? 'hash' : 'history',
    base: process.env.BASE_URL,
    routes
});

export default router;
